<template>
	<view class="content">
		<swiper class="swiper">
			<swiper-item class="swiper-item" v-for="(item,index) in swiperData" :key="index">
				<view class="swiper-item">
						<image class="swiper-item-img" :src="item.src" mode="aspectFit"></image>
				</view>
				<view class="jump-over" @tap="launchFlag()">{{jumpover}}</view>
				<view v-if="index==swiperData.length - 1" class="experience" @tap="launchFlag()">{{experience}}</view>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	import mixins from '@/mixins/index';
	import {authCheck,forwardLogin} from '@/utils/page'
	import UserService from '@/services/user/index';
	const service = new UserService(false);
	export default {
        name:'guide',
        props:{
		},
		data() {
			return {
                jumpover:'跳过',
                experience:'立即体验',
                swiperData: []
			}
		},
		methods: {
            launchFlag(){
                /**
                 * 向本地存储中设置launchFlag的值，即启动标识；
                 */
                uni.setStorage({
                    key: 'launchFlag',
                    data: true,
				});
					authCheck({
						exceptionCallback:()=>{
							if(this.userDataForLogin!=undefined && this.userDataForLogin.gesture!=undefined){
								uni.reLaunch({
									url: '/pages/system/gestureLock/gestureLock'
								})
							}else{
								forwardLogin()
							}
						},
							callbackSuccess:()=>{
								uni.switchTab({
									url: '/pages/tabbar/home/index'
								});
							}
                            })
            }
		},
		onLoad(){
			service.guilde().then(result=>{
				if(result.success){
					this.swiperData = result.result;
				}
			})
		}
	}
</script>
<style>
	page,
	.content{
		width: 100%;
		height: 100%;
		background-size: 100% auto ;
		padding: 0;
	}
	.swiper{
		width: 100%;
		height: 100%;
		background: #FFFFFF;
	}
	.swiper-item {
		width: 100%;
		height: 100%;
		text-align: center;
		position: relative;
		display: flex;
		/* justify-content: center; */
		align-items:flex-end;
		flex-direction:column-reverse
	}
	.swiper-item-img{
		width: 100%;
		height: 100%;
		margin: 0 auto;
	}
	.swiper-item-img image{
		width: 80%;
	}
	.uniapp-img image{
		width: 40%;
	}
	
	.jump-over,.experience{
		position: absolute;
		height: 60upx;
		line-height: 60upx;
		padding: 0 40upx;
		border-radius: 30upx;
		font-size: 32upx;
		color: #454343;
		border: 1px solid #454343;
		z-index: 999;
	}
	.jump-over{
		right: 45upx;
		top: 125upx;
	}
	.experience{
		right: 50%;
		margin-right: -105upx;
		bottom: 100upx;
	}
</style>
